package pack.ajedrez;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import conexionWS.serviciosWS;

public class Principal extends Activity {
	private serviciosWS servicio = new serviciosWS();

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.principal);
		Bundle bundle = getIntent().getExtras();

		final String nombreUsuario = bundle.getString("usuario");
		final Button btnNuevaPartida = (Button) findViewById(R.id.btnNuevaPartida);
		final Button btnEstadisticas = (Button) findViewById(R.id.btnEstadisticas);
		final Button btnIrLobby = (Button) findViewById(R.id.btnIrLobby);

		btnNuevaPartida.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Bundle bundle = new Bundle();
				bundle.putString("usuario", nombreUsuario.toString());
				Intent intent = new Intent(Principal.this,
						ConfigurarJuego.class);
				intent.putExtras(bundle);
				startActivity(intent);
			}
		});

		btnEstadisticas.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {

			}
		});

		btnIrLobby.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Bundle bundle = new Bundle();
				bundle.putString("usuario", nombreUsuario);
				Intent intent = new Intent(Principal.this, Lobby.class);
				intent.putExtras(bundle);
				startActivity(intent);
			}
		});
	}
}
